import router from '@/router'
const wirteList=['/404','/login']
router.beforeEach((to,from,next)=>{
  // 去登录
  const token=localStorage.getItem('token')
  // 有token
  if(token){
    if(to.path==='/login'){
      next('/')
    }else{
      next()
    }
  }else{
    if(wirteList.indexOf(to.path)>-1){
      next()
    }else{
      next('/login')
    }
  }
})